package com.shinhye.elephantsafe.ui;

import com.shinhye.elephantsafe.R;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class SetPreferRelativeLayout extends RelativeLayout {

	private TextView tv_name;
	private TextView tv_desc;
	private String name;
	private String desc;

	public SetPreferRelativeLayout(Context context, AttributeSet attrs,
			int defStyle) {
		super(context, attrs, defStyle);
		init(context);
	}

	public SetPreferRelativeLayout(Context context, AttributeSet attrs) {
		super(context, attrs);
		
		int name_resVal = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/com.shinhye.elephantsafe", "stylename", 0);
		name = getContext().getString(name_resVal);
		int desc_resVal = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/com.shinhye.elephantsafe", "desc", 0);
		desc = getContext().getString(desc_resVal);

		init(context);
		
		setSettingName(name);
		setDesc(desc);
	}

	public SetPreferRelativeLayout(Context context) {
		super(context);
		init(context);
	}
	
	private void init(Context context) {
		View.inflate(context, R.layout.item_setting_setprefer, SetPreferRelativeLayout.this);
		tv_name = (TextView) findViewById(R.id.tv_setting_name2);
		tv_desc = (TextView) findViewById(R.id.tv_setting_desc2);
	}

	public void setSettingName(String name) {
		tv_name.setText(name);
	}

	public void setDesc(String desc) {
		tv_desc.setText(desc);
	}

}
